cc.Class({
    extends: cc.Component,

    properties: {
        Label: cc.Label,
        gameIcon: cc.Sprite
    },

    // use this for initialization
    onLoad: function () {

    },

    init(data){
        this.appId = data.AppId;
        this.Label.string = data.name
        this.show(data);
        this.click();
    },
    
    show(data){
        if(cc.gameIcon.icon[data.AppId]){
            this.gameIcon.spriteFrame = cc.gameIcon.icon[data.AppId];
        }else{
            cc.gameIcon.loader(data, this)
        }
    },

    click(){
        this.node.on("click", function(){
            FBInstant.switchGameAsync(this.appId).catch(function (e) {
                console.log("switchGameErr");
            });
        }, this)
    }
    

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
